﻿using System.Xml.Serialization;
using NUnit.Framework;

namespace TestHelpers.Core
{
    public static class AssertValues
    {
        public static void AreEqual<T>(T expected, T actual)
        {
            Assert.AreEqual(Serialize(expected),Serialize(actual));
        }

        private static string Serialize(object obj)
        {
            var ser = new XmlSerializer(obj.GetType());
            var sb = new System.Text.StringBuilder();
            ser.Serialize(new System.IO.StringWriter(sb), obj);

            return sb.ToString();
        }
    }
}